//
//  DetailViewController.m
//  分屏显示4
//
//  Created by 奚旺 on 15/12/8.
//  Copyright © 2015年 奚旺. All rights reserved.
//

#import "DetailViewController.h"
#import "XWMain.h"
#import "UIImageView+WebCache.h"

@interface DetailViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageV;
@property(nonatomic,strong)UILabel * titleLabel;

@end

@implementation DetailViewController

#pragma mark - Managing the detail item

- (void)awakeFromNib {
    
    
    
}

- (void)setDetailItem:(id)newDetailItem {
    

    _detailItem = newDetailItem;
            
        // Update the view.
    [self configureView];
}

- (void)configureView {
    // Update the user interface for the detail item.
    if (self.detailItem) {
        
        
        XWMain * main = self.detailItem;
        NSLog(@"~~~~~~%@",main.title);
        self.detailDescriptionLabel.text = main.title;
        NSLog(@"asdkfsadf  %@", self.titleLabel.text);
        NSRange range = NSMakeRange(0, 3);
        
        NSString * imageUrl = [NSString stringWithFormat:@"http://image.gooju.cn/images/%@/9/%@_0_9-.jpg",[main.covorPhotoId.description substringWithRange:range],main.covorPhotoId.description];
        
        [self.imageV sd_setImageWithURL:[NSURL URLWithString:imageUrl]];
        
   
          }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.frame = CGRectMake(0, 0, self.view.frame.size.width, 50);
    self.titleLabel.center = CGPointMake(self.view.frame.size.width/2, 400);
    self.titleLabel.backgroundColor = [UIColor yellowColor];

   [self.view addSubview:self.titleLabel];
    [self configureView];
    
    // Do any additional setup after loading the view, typically from a nib.
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
